<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                 java.util.ArrayList,
                 com.scalar.forecast.commons.Constants,
                 java.util.Calendar"%>
<%@ taglib uri="/WEB-INF/struts-html.tld"  prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld"  prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-nested.tld"  prefix="nested"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld"  prefix="bean"%>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>
<SCRIPT language=JavaScript src="<%=chipTracContext%>/jsp/includes/scripts/validations.js">
</SCRIPT>
<SCRIPT language=JavaScript src="<%=chipTracContext%>/jsp/includes/scripts/functions.js">
</SCRIPT>
<SCRIPT>

          /*function onCheckDisabled()
          {*/


                    /*if ( document.salesForecastReportForm.category[0].checked )
                    {
                       document.salesForecastReportForm.reportType[0].disabled = false;
                       document.salesForecastReportForm.reportType[1].disabled = true;
                       document.salesForecastReportForm.reportType[0].checked = true;
                       document.salesForecastReportForm.reportType[1].checked = false;
                       document.salesForecastReportForm.confidenceLevel.disabled = false;
                    }
                    else if ( document.salesForecastReportForm.category[1].checked )
                    {
                       document.salesForecastReportForm.reportType[0].disabled = true;
                       document.salesForecastReportForm.reportType[1].disabled = false;
                       document.salesForecastReportForm.reportType[0].checked = false;
                       document.salesForecastReportForm.reportType[1].checked = true;
                       document.salesForecastReportForm.confidenceLevel.disabled = true;
                    }
                    else
                    {
                       document.salesForecastReportForm.reportType[0].disabled = true;
                       document.salesForecastReportForm.reportType[1].disabled = false;
                       document.salesForecastReportForm.reportType[0].checked = false;
                       document.salesForecastReportForm.reportType[1].checked = true;
                       document.salesForecastReportForm.confidenceLevel.disabled = true;
                    }*/


                    /*if ( document.salesForecastReportForm.period[0].checked )
                    {
                       document.salesForecastReportForm.quarter.disabled = false;
                       document.salesForecastReportForm.fromMonth.disabled = true;
                       document.salesForecastReportForm.toMonth.disabled = true;
                    }
                    else if ( document.salesForecastReportForm.period[1].checked )
                    {
                       document.salesForecastReportForm.quarter.disabled = true;
                       document.salesForecastReportForm.fromMonth.disabled = false;
                       document.salesForecastReportForm.toMonth.disabled = false;
                    }*/

          //}


           function onSubmit()
           {
                  /*  var valid = true;
                    var pa=document.getElementById("errors");
                    pa.innerHTML = "";
                    if(document.salesForecastReportForm.product.value == 0)
                    {
                        valid = false;
                        pa.innerHTML = "<li> Please select a Product";
                    }

                    if ( document.salesForecastReportForm.period[1].checked )
                    {
                        var fMonth      =   document.salesForecastReportForm.fromMonth.value;
                        var tMonth     =   document.salesForecastReportForm.toMonth.value;
                        if( parseInt(tMonth) <  parseInt(fMonth) )
                        {
                            valid = false;
                            pa.innerHTML = pa.innerHTML+"<li> Please select To Date greater than or equal to From Date";
                        }
                    }*/

                    /*var selectCategory
                    for ( counter = 0; counter < salesForecastReportForm.category.length; counter++ )
                    {
                        if ( salesForecastReportForm.category[counter].checked )
                        {
                            selectCategory = salesForecastReportForm.category[counter].value;
                            document.salesForecastReportForm.prompt5.value = salesForecastReportForm.category[counter].value;

                        }
                    }*/

                    /*var selectPeriod
                    for ( counter = 0; counter < salesForecastReportForm.period.length; counter++ )
                    {
                        if ( salesForecastReportForm.period[counter].checked )
                        {
                            selectPeriod = salesForecastReportForm.period[counter].value;
                            document.salesForecastReportForm.prompt6.value = salesForecastReportForm.period[counter].value;

                        }
                    }*/

                    var d = new Date();
                    var day = d.getDate();
                    var month = d.getMonth()+1;
                    var year = d.getFullYear();
                    var hour = d.getHours();
                    var min = d.getMinutes();
                    var sec = d.getSeconds();

                    var defaultPrompt = day+"/"+month+"/"+year+":"+hour+":"+min+":"+sec;
                    document.salesForecastReportForm.prompt0.value = defaultPrompt;

                    /*document.salesForecastReportForm.prompt0.value = document.salesForecastReportForm.endcustomer.value;
                    document.salesForecastReportForm.prompt1.value = document.salesForecastReportForm.product.value;
                    document.salesForecastReportForm.prompt2.value = document.salesForecastReportForm.salesrep.value;
                    document.salesForecastReportForm.prompt3.value = document.salesForecastReportForm.quarter.value;
                    document.salesForecastReportForm.prompt4.value = document.salesForecastReportForm.year.value;
                    //document.salesForecastReportForm.prompt7.value = document.salesForecastReportForm.confidenceLevel.value;
                    document.salesForecastReportForm.prompt7.value = document.salesForecastReportForm.fromMonth.value;
                    document.salesForecastReportForm.prompt8.value = document.salesForecastReportForm.toMonth.value;
                    */
                    /*if(selectCategory == 'byEndCust')
                    {
                         document.salesForecastReportForm.action = "<%=chipTracContext%>/jsp/report.jsp?nameReport=Forecast/Forecast_Vs_Backlog_by_end_customer.rpt";
                    }
                    else if(selectCategory == 'byProduct')
                    {
                        document.salesForecastReportForm.action = "<%=chipTracContext%>/jsp/report.jsp?nameReport=Forecast/Forecast_Vs_Backlog_by_product.rpt";
                    }
                    else
                    {
                        if(selectPeriod == 'byQuarter')
                        {
                            document.salesForecastReportForm.action = "<%=chipTracContext%>/jsp/report.jsp?nameReport=Forecast/Forecast_SalesPerson.rpt";
                        }
                        else
                        {
                            document.salesForecastReportForm.action = "<%=chipTracContext%>/jsp/report.jsp?nameReport=Forecast/Forecast_SalesPerson_By_Month.rpt";
                        }
                    }*/

                    /*if(valid == true)
                    {*/
                        document.salesForecastReportForm.action = "<%=chipTracContext%>/jsp/report.jsp?nameReport=Forecast/Forecast_Vs_Actual_by_end_customer.rpt";
                        document.salesForecastReportForm.submit();
                    //}
            }


</SCRIPT>
<META content="MSHTML 6.00.2800.1458" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginwidth="0" marginheight="0" <%--onLoad="onCheckDisabled();" --%> >
<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0><!--TBODY-->
  <TBODY>
  <TR>
    <TD vAlign=top width=180 background="<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif">
  <!-- Side Navigation start -->
    <%@ include file="/jsp/marketing/marketing_report_menu.jsp" %>
 <!-- end of the side navigations -->
    <TD bgColor=#ffffff><IMG height=9
      src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
    <TD bgColor=#ffffff><IMG height=480
      src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=10></TD>
    <TD vAlign=top width="100%"><IMG height=1
      src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0> <BR>
<!-- from here your body starts -->
<html:form action="/forecastActualReport" name="salesForecastReportForm" type="com.scalar.forecast.forecastReports.forms.SalesForecastReportForm" >
<input type="hidden" name="prompt0">
<input type="hidden" name="prompt1">
<input type="hidden" name="prompt2">
<input type="hidden" name="prompt3">
<input type="hidden" name="prompt4">
<input type="hidden" name="prompt5">
<input type="hidden" name="prompt6">
<input type="hidden" name="prompt7">
<input type="hidden" name="prompt8">
<input type="hidden" name="prompt9">
<input type="hidden" name="prompt10">


      <TABLE width="100%" align=center border=0>
        <TBODY>
        <TR>
           <TD class=NArialW align=middle colSpan=5> Top 20 Forecast </TD></TR>
        <TR>
        <TD colSpan=5>&nbsp;</TD></TR>
        <TR><TD colspan='5'><chiptrack:errors styleClass='NArialL' /></TD></TR>
        <TR><TD colspan='5'><chiptrack:info styleClass='NArialL' /></TD></TR>
        <TR><TD colspan='5' class="NArialL"><font styleClass="NArialL" id='errors' color="FF0000"></font></TD></TR>

        <TR>
              <%--  <tr><td colsapn=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                  <tr>
                  <td width="25%"><font class="NArialL">&nbsp;End Customer:</font></td>
                  <td width="20%"><font class="NArialL">
                      <select name="endcustomer" class="txfield" >
                        <option value="0" >Select Any End Customer</option>
                         <logic:iterate id="endUserList" name="endUserList">
                            <logic:notEqual name="endUserList" value="null">
                                <option value = "<bean:write name="endUserList" property="value"/>">
                                    <bean:write name="endUserList" property="label"/>
                                </option>
                            </logic:notEqual>
                        </logic:iterate>
                      </select>
                  </td>
                  <td width="10%">&nbsp;</td>
                  <td width="20%"><font class="NArialL">Product:</font></td>
                  <td width="25%"><font class="NArialL">
                      <select name="product" class="txfield" >
                        <option value="-1" >Select Any Product</option>
                         <logic:iterate id="productsList" name="productsList">
                            <logic:notEqual name="productsList" value="null">
                                <option value = "<bean:write name="productsList" property="value"/>">
                                    <bean:write name="productsList" property="label"/>
                                </option>
                            </logic:notEqual>
                        </logic:iterate>
                      </select>
                  </td>
                  </tr>

                   <tr><td colsapn=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>

                    <tr>
                          <td width="25%"><font class="NArialL">&nbsp;Sales Person:</font></td>
                          <td width="20%"><font class="NArialL">
                              <select name="salesrep" class="txfield">
                               <option value="0" >Select Any Sales Person</option>
                                <logic:iterate id="salesRepList" name="salesRepList">
                                    <logic:notEqual name="salesRepList" value="null">
                                       <option value = "<bean:write name="salesRepList" property="value"/>">
                                            <bean:write name="salesRepList" property="label"/>
                                       </option>
                                    </logic:notEqual>
                                </logic:iterate>
                              </select>
                          </td>
                          <td width="10%">&nbsp;</td>
                          <%--<td width="20%"><font class="NArialL">Confidence Level:</font></td>
                          <td width="25%"><font class="NArialL">
                               <nested:select property="confidenceLevel" styleClass="valuetxfield">
                                    <option value="-1.0">Select Any Confidence Level</option>
                                    <html:option value="0.0">0%--Lead</html:option>
                                    <html:option value="25.0">25%--Qualified</html:option>
                                    <html:option value="50.0">50%--Pend Design Win</html:option>
                                    <html:option value="75.0">75%--Design Win</html:option>
                                    <html:option value="90.0">90%--Production</html:option>
                                    <html:option value="100.0">100%--Mass Prod</html:option>
                               </nested:select>
                          </td>--%>
                 <%--   </tr>
                        <tr><td colsapn=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                     <tr>
                        <td colspan=5>
                            <input type="radio" name="period" value="byQuarter" checked  onclick = "javascript:onCheckDisabled();">
                            <font class="NArialL">By Quarter</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <input type="radio" name="period" value="byMonth" onclick = "javascript:onCheckDisabled();">
                            <font class="NArialL">By Month</font>
                        </td>
                    </tr>

                       <tr><td colsapn=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                   <tr>
                   <td width="25%"><font class="NArialL">&nbsp;Quarter</font></td>
                      <td width="20%"><font class="NArialL">
                      <select name="quarter" class="txfield">
                           <% String currentQtr = (String) request.getAttribute("currentQtr"); %>
                           <logic:iterate id="quarterList" name="quarterList">
                                <logic:notEqual name="quarterList" value="null">
                                    <logic:equal name="quarterList" property="value" value="<%=currentQtr%>">
                                        <option value = "<bean:write name="quarterList" property="value"/>" SELECTED>
                                            <bean:write name="quarterList" property="label"/>
                                        </option>
                                    </logic:equal>
                                    <logic:notEqual name="quarterList" property="value" value="<%=currentQtr%>">
                                        <option value = "<bean:write name="quarterList" property="value"/>" >
                                            <bean:write name="quarterList" property="label"/>
                                        </option>
                                    </logic:notEqual>
                                </logic:notEqual>
                            </logic:iterate>
                       </select>
                      </td>
                       <td width="10%">&nbsp;</td>
                      <td width="25%"><font class="NArialL">Year </font></td>
                      <td width="20%"><font class="NArialL">
                         <html:select name="year" property="year" styleClass="txfield" value='<%=Integer.toString(Calendar.getInstance().get (Calendar.YEAR))%>'>
                            <html:options collection="yearsList" property="value" labelProperty="label" />
                         </html:select>
                       <td width="10%">&nbsp;</td>

                    </tr>

                       <tr><td colsapn=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                   <tr>
                      <td width="25%"><font class="NArialL">&nbsp;From Date</font></td>
                      <td width="20%"><font class="NArialL">
                        <nested:select property="fromMonth" styleClass="txfield">
                            <html:options collection="monthsList" property="value" labelProperty="label"/>
                        </nested:select>
                     </td>
                      <td width="10%">&nbsp;</td>
                      <td width="25%"><font class="NArialL">To Date </font></td>
                      <td width="20%"><font class="NArialL">
                        <nested:select property="toMonth" styleClass="txfield">
                            <html:options collection="monthsList" property="value" labelProperty="label"/>
                        </nested:select>
                        <td width="10%">&nbsp;</td>
                   </tr>
                        <tr><td colsapn=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
                    <%--<tr>
                        <td colspan=5>
							<TABLE>
								<TR>
									<TD> <input type="radio" name="category" value="bySalesPerson" checked  onclick = "javascript:onCheckDisabled();">
										 <font class="NArialL">By Sales Person&nbsp;&nbsp;&nbsp; </font></TD>
                                    <TD> <input type="radio" name="category" value="byProduct" onclick = "javascript:onCheckDisabled();">
                                         <font class="NArialL">By Product&nbsp;&nbsp;&nbsp;</font> </TD>
									<TD> <input type="radio" name="category" value="byEndCust" onclick = "javascript:onCheckDisabled();">
										 <font class="NArialL">By End Customer&nbsp;&nbsp;&nbsp; </font> </TD>
								</TR>
								<TR>
									<TD> <img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10> </TD>
								</TR>
								<TR>
									<TD> <font class="NArialL">Report Type: </font> </TD>
									<TD> <input type="radio" name="reportType" value="forecast" checked>
										<font class="NArialL">Forecast </font> </TD>
									<TD> <input type="radio" name="reportType" value="forecastBacklog">
										<font class="NArialL">Forecast Vs. Backlog</font></TD>
								</TR>
							</TABLE>
                        </td>
                    </tr>--%>
                    <tr><td>&nbsp;</td></tr>


              <TR>
                <TD bgColor=#ffffff><IMG height=9
                  src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD></TR>
              <TR>
                <TD width="100%" colSpan=5 align="center">
                    <A href="javascript:onSubmit();"><IMG
					onmouseover="window.status='Click to generate Forecast Report';return true"
					title="Click to generate Forecast Report"
					onmouseout="window.status='';return true" height=17
					src="<%=chipTracContext%>/jsp/includes/images/submit.gif" width=53
					border=0></A>&nbsp;&nbsp;&nbsp;&nbsp;
                 <%-- <A href="javascript:document.salesForecastReportForm.reset();"><IMG
					onmouseover="window.status='Click to Reset';return true"
					title="Click here to Reset"
					onmouseout="window.status='';return true"
					src="<%=chipTracContext%>/jsp/includes/images/reset.gif"
					border=0 width="53" height="17"></A> --%>
                </TD>
                </TR>
            </TBODY></TABLE></TD></TR>
</html:form>

        <TR>
          <TD><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"
width=10></TD></TR>


		 </TBODY></TABLE></TD>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>
